(function () {
    var id = 'js_pop_ad_2016_01';
    var imgUrl = '//contract-yl-frontend.myysq.con.cn:1003/static_public/ad/2016_01/new_year_day_mobile.jpg';
    var animImg = 'http://contract-yl-frontend.myysq.con.cn:1003/static_public/ad/2016_01/new_year_day_5-6.png';

    window.POP_1AD1_Mobile({
        key: id,
        html: '<div id="' + id + '" style="position:absolute;transition-duration:1s;margin-top:50px;opacity:0;width:80%;visibility:hidden;">' +
        '<img src="' + imgUrl + '" style="width:100%;">' +
        '<div class="anim" style="position:absolute;top:58.985%;left:42.627%;width:9.454%;height:12.615%;transition-duration:.5s;background:no-repeat url(' + animImg + ') center top;background-size: 100% auto;"></div>' +
        '</div>',
        expires: 7,
        startTime: new Date(2016, 0, 1, 0, 0, 0, 0).getTime(),
        endTime: new Date(2016, 0, 4, 0, 0, 0, 0).getTime(),
        timeout: 10000,
        preLoadImages: [imgUrl, animImg],
        show: function () {
            setTimeout(function () {
                var element = document.getElementById(id);
                var style = element.style;

                setTimeout(function () {
                    var screen = window.screen;
                    var clientRect = element.getBoundingClientRect();

                    style.top = (screen.height - clientRect.height) / 2 + 'px';
                    style.left = (screen.width - clientRect.width) / 2 + 'px';
                    style.visibility = 'visible';
                    style.opacity = 1;
                    style.marginTop = '0px';

                    setTimeout(function () {
                        element.getElementsByTagName('div')[0].style.backgroundPositionY = 'bottom';
                    }, 1200);

                }, 25);
            }, 50);
        }
    });
})();
